package com.study.talk.module.mapper;

import com.study.talk.module.entity.GroupInfo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.study.talk.module.entity.UserInfo;
import org.apache.ibatis.annotations.Select;
import org.mapstruct.Mapper;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author thor
 * @since 2023-12-18
 */
@Mapper
public interface GroupInfoMapper extends BaseMapper<GroupInfo> {
    @Select("select * from group_info where status=0 AND name like %#{groupName}%")
    List<GroupInfo> queryGroupInfoByGroupName(String groupName);

    @Select("SELECT b.* FROM group_user_info as a,group_info as b WHERE b.status=0 AND a.user_id=#{userId} AND a.group_id=b.id")
    List<GroupInfo> queryGroupListByUserId(Integer userId);
}
